package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

//    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
//    public static String app_id = "2018032602447055";
//
//    // 商户私钥，您的PKCS8格式RSA2私钥
//    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCjnZ5HNOInA01FDOiND8d6URSGbUhTYzcIDsBiCvGrpC8RNlpEDRLp/D7S2sAnX4m+a9X6mTTfknj/Ksu2xAhkkV+0VCyfFwAw6ZLwy1Qet5Fg9U3xOYPX5IQiglBKSCHi/V+LrONsYYasQkmWwEp4D1LjefF+Q0Noq6czd9fQLENYjHmBhzrVVJs7YOQKDuduECdJylhq37RL+UD8uH8qwq8wrVEKvWaNydWecOm9W8r2zdzxsod9h/1iDgxikk2fbnsuizJ1bUFZBMG3NcTEdAdpQVSvypLzOn3uZxXw7JVNwouHmwd+tRFFybwfxcTeafVleANveZnAUnrqZNcZAgMBAAECggEAdV6rXT9VgFEBDCivZgnMujURuUEJ4i/JGXGjlnFtXgigbwODi0+posp9srqTn2sMn9oxnNxsrnkfbUSg8FH+B061zeGYROO2EmBsNWpWxNZAZsJyEDqHFsdp9mtu92p5TKEf+k2is2vetRG0Qn1crnWnq2Ed2Mqdv6drgSNWYJFKbosWjWDFHrjCSBaku4CHKGbhAJhfccT63A2BacEiynvqffsQNtfgHl8z+OVhO/N7k3n4c6124HW80H/ZJiqT2o77a8B1pyZk8I5xxeEh1CM+/NW27inlCvGFzx2HUyxBg/XuP0xw22IZeX1DKI10ytSKTAKUIpjEUqnFNI/pBQKBgQDQH0uj4h7KsJODm0SD9WhF3qOK3/11I9N58AfbNhmCbfO+3tKNlZgPq8PyVAwhRbYXHhEcgckHTSUNyWoZxiJBYYaP9VCxZHb+sZJIa/MrcDl1OOYB3pwNTx+M2jrjQT20rHys6IdVy1iL0Rzh08izbDeHqSPb4il15wDsAOSzdwKBgQDJQT/kU/H5CSngUBkU9kD5fy+o1j3Sun3GgppFKwCQaSddehIN1eL45UhxpCLDdhozr6va9pBipg5dCkORWNXzezXFO634N5A9/NwugaX6MEdLyUBl08vie/yTGa0PBWqOlDfWAA85AwxXCtCEE7EQ8YzGw2tQBUHbgXaslO3N7wKBgD8g7wmz4hErRGOMKlk4jDt9T/AlBzWL+26mT0u/+jbk8SV5YzaNJMXEHTiZI+DHy3bxqNET0Q2E6fNnn+ZXgjaAxZdPGv3j8nBJHo0XKXiInvUeoC36/yzOTkykOW6LcJMoKt0r3zk36BDpCjC508wQzDs7I+Rjkp3vxwjPMI/7AoGAHSuK8jJEoT71xeB2MjabJk6L/uHGpjOHpW0qpRndhBDptr/JvB2jP0YkYOxUaZZFp/YvZ5ZTSSkebdfeAUQqBpd2LLdAuPh8vK9YzpjWENRMkSyDW/79zz7/Vebj0YiMcEwFZ8wsaKwLbtZPcMVV5cnNCMYsWLXaXNF//PW9HhsCgYEAxk3qU3xcaQYThFMEBcLGIgGiyIunupCWC1Vgbf8VL1GYk2TTrbUjIK1IVx1eVjN8iDssfuoroVdjku9Wb9WfrRnIF704H48r41/VGaLMB2O3mUyahjW30fJS6zHRmIHXZkIErPOBFUfuharao/f7xa42bZ3UKo0OwavwdbuybhU=";
//
//    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
//    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo52eRzTiJwNNRQzojQ/HelEUhm1IU2M3CA7AYgrxq6QvETZaRA0S6fw+0trAJ1+JvmvV+pk035J4/yrLtsQIZJFftFQsnxcAMOmS8MtUHreRYPVN8TmD1+SEIoJQSkgh4v1fi6zjbGGGrEJJlsBKeA9S43nxfkNDaKunM3fX0CxDWIx5gYc61VSbO2DkCg7nbhAnScpYat+0S/lA/Lh/KsKvMK1RCr1mjcnVnnDpvVvK9s3c8bKHfYf9Yg4MYpJNn257LosydW1BWQTBtzXExHQHaUFUr8qS8zp97mcV8OyVTcKLh5sHfrURRcm8H8XE3mn1ZXgDb3mZwFJ66mTXGQIDAQAB";

    /*********沙箱环境测试 start*************/

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016091100484413";
    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDHG/YqJdD/Kr6wVtRpMPr3fLwJvVqWSbE6xPBhn9Ds8U+YnhpXTgzWPlNNUWJ/S67e85DTsO9Kkws3SdfsPgav45zLAlgpQvGt1DGkGoEf5biNg7Mb3/YwNe8yoKO9ohiw9Aa3Rfpho10+t8fjzEujrlF0c3lKVQHNBzC9zjkrXGtEvBUmOdmanzvbfBvLoUBgs4GdggyiuZtE/fWbY3goWQ8Pnm/HjeNDKFe+zSY6YQiV0nBkaTW09NifXYQ58UyWxUyQtIBAxo/4WORiz3QelEY2dINsenSmwkLLYlcA7wnS3i4sawKMUKP+64zrv7Bjms41V+4wndbnza5cY0sBAgMBAAECggEAZnd2XMRvZRHbZqaY07W4Qis4Hg8LknJEOgll5+e2PmoFW3Zp+eoZ4xvaBN1QQlBxox1XuAnDa+52hDKFY3ecO2J4q2T+d+WSuLGOBnT5ZK/1JSbUwxCkArWO7tAK1CmaaV58Ik9qBltrPj6YKRxXBNpN4w8WKXHL5na/175MX4pb+eXZvnt1JcyrDCo31fduumctIbG7RSyklyN0VfqFrLWsCXkYz04hAkJwiHgNDFh10opJkRBQwPRD2mA2lPPz/kfl/kKyS5ZCptfCdW7DzCTfRTCLNJxXSz49wimFUZlhilDgJPclDwYtq9Bfb4PipcOozWCRuHm1Hy5hshQwvQKBgQD3IyNxHLtyWv3WjKm/br3qsI95G7ij7vvg8QlBwwQAgVz3ejBR9z140up/PsgW/SlfyajTurfNPZ6C+9v0h+2qJ2f9sOsNgKQK+Za0ZtjbQ8W01uGJgQp3d1SmZZ6FHUCqfO71uiPLnDTyhxRY/f4yR+ZQQNR05qTbWk05MYIBlwKBgQDOP+X1eLTGnpRjE92KmCTXgdcdtyXj4wHG9cBosJXY68QTw8DJ2o3Rw1ZhGry4MJ0SpxNB7sIxFbmgHjYZKb9/DAfBTiFbBVrM2i9hSiww3CNCB+Y5a2BahPuM9Ka639+A9Kc81beeuillaa073n07NZ+wrHKpD/TLugu4Cur7JwKBgQDN1X5XX07f19lDMLTQtDOJnLRiciw+nXU7zIWhOAPFR/leRW6pVfrk/wZAJNISE5i6JwNuFT2wu3miLpLr/6p65Yc/THL5NANtAKP8bQyA0tl/3NjL5aYKCmF+lXSJ+es6FAQStY3Kr7eJp+fSlvl4d1njzZsmIlN8PqHC2PEm0QKBgDo26u9oTI4rQHLero9p9iwl59PpV/aEooHH57Ek9oattUBm5kmTOKhWXFE4PMA4aH1VTygy/fjgyu4Y2OgtUnHHsYCsTtnkHwbnJqxtRR/dYs5GcIMQfbfPBTl57H2epvU9GN8g650PqpOHSnA1kl9d+V7irdJuQIgoURp3am/NAoGBAJsys768pnQYll5ie8hw7UQ+Ggqy3Im9tayd5YrY8jMU1s7wHjFk+Zae7oz9jPBO1jsx64urbn0yo9fxMV5DsTHgfOGDCscrWPoemi8Si21fioz7SAvVit/ipka4QDWYvfy28+idrPxnMSIjAUydZnep592UpHHWYNNbcbCv6mv0";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxxv2KiXQ/yq+sFbUaTD693y8Cb1alkmxOsTwYZ/Q7PFPmJ4aV04M1j5TTVFif0uu3vOQ07DvSpMLN0nX7D4Gr+OcywJYKULxrdQxpBqBH+W4jYOzG9/2MDXvMqCjvaIYsPQGt0X6YaNdPrfH48xLo65RdHN5SlUBzQcwvc45K1xrRLwVJjnZmp8723wby6FAYLOBnYIMormbRP31m2N4KFkPD55vx43jQyhXvs0mOmEIldJwZGk1tPTYn12EOfFMlsVMkLSAQMaP+FjkYs90HpRGNnSDbHp0psJCy2JXAO8J0t4uLGsCjFCj/uuM67+wY5rONVfuMJ3W582uXGNLAQIDAQAB";
    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    /*********沙箱环境测试 end*************/

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://47.98.142.255:8080/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://47.98.142.255:8080/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
//    public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";


    // 支付宝网关
    public static String log_path = "C:\\logs";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

